const common ={
    //下导航 展开关闭
    onChangedownmenu: function (e) {
        var that = this;
        var dmopen = e.currentTarget.dataset.values;
        console.log(e);
        that.setData({
            downmenuzt: dmopen
        });
    },
    //下拉 监听 scllo滚动条位置
    scroll: function (e) {
        var that = this;
        console.log(e.detail.scrollTop);
        that.setData({
            scrollTopmenu: e.detail.scrollTop,
        })
        if (e.detail.scrollTop > 100) {
            that.setData({
                floorstatus: true
            });
        } else {
            that.setData({
                floorstatus: false
            });
        }

    },
    //监听 page 滚动条位置
    onPageScroll: function (res) {
      //console.log(res.scrollTop);
      if (res.scrollTop >= 400) {
        this.setData({
          floorstatus: true
        })
      } else {
        this.setData({
          floorstatus: false
        })
      }
    },
    //返回顶部
    gotop: function (e) {
        var that = this;
        that.setData({
            scrollTop: 0
        })
    },
    //page 返回顶部 点击顶部时间未知也可返回顶部
    pagegotop: function (e) {
      wx.pageScrollTo({
        scrollTop: 0,
        duration: 300
      })
    },
    /*监听图片加载*/
    _imgOnLoad: function (e) {
      //console.log(e)
      var loadedUrl = e.target.id
      let that = this
      let list = that.data.list
      for (var i = 0; i < list.length; i++) {
        if (list[i].pic == loadedUrl) {
          list[i].loaded = true
        }
        that.setData({
          list
        })
      }
    },
}
export default common;
